package com.nave.princesslife.main;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Paint;

import com.nave.princesslife.R;

public class Princess {

	public static Princess instance;

	private Paint paint;
	private Bitmap bitmap;

	private int x, y, w, h;
	private int halfW, halfH;

	private Princess() {
	}

	public static Princess getInstance() {

		if (instance == null)
			instance = new Princess();

		return instance;
	}

	public void setup(Context context, int w, int h) {

		paint = new Paint();
		paint.setColor(Color.WHITE);

		//Coletar a imagem na pasta res/drawable
		bitmap = BitmapFactory.decodeResource(context.getResources(),
				R.drawable.mainscreen_princess_1);

		if (bitmap != null) {

			//Centralizar imagem
			halfW = bitmap.getWidth() / 2;
			halfH = bitmap.getHeight() / 2;
			this.w = bitmap.getWidth();
			this.h = bitmap.getHeight();
			
			x = (w / 2) - halfW;
			y = (h / 2) - halfH;
		}
	}

	public void draw() {
		Game.getCanvas().drawBitmap(bitmap, getX(), getY(), null);
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

	public int getW() {
		return w;
	}
	
	public int getH() {
		return h;
	}
}